from selenium import webdriver
import time
from selenium.webdriver.common.by import By
brower = webdriver.Chrome()
url = 'https://quote.eastmoney.com/center/gridlist.html'
brower.get(url)

list1= []
list2= []
list3= []
for k in range(100):
    for i in range(3):
        time.sleep(1)
        res = brower.find_elements_by_class_name("mywidth")
        for i in res:
            a = i.text
            if len(a) == 3:
                a = a + "  "
            else: 
                list1.append(a)
        resw = brower.find_elements(By.XPATH, '//table[@class="table_wrapper-table"]/tbody/tr/td[9]')
        for i in resw:
            list2.append(i.text)
        print("-------------------------")
        print("股票行情    昨日成交额")
        # print(list1,list2)
        for i in range(len(list1)):
            print(list1[i] +"     "+ list2[i])
        nest = brower.find_element_by_css_selector('.next.paginate_button')
        nest.click()
        list1 = []
        list2 = []
        print("-------------------------")

    a = str(input("按任意键刷新,输入x退出"))
    if a == "x":
        brower.quit()
        quit()